add_rules("mode.debug", "mode.release")

set_languages("c++20")

add_cxxflags("-stdlib=libstdc++","-fcoroutines","-fmodules-ts","-Wall","-Werror","-fpermissive","-Wreturn-type","-freport-bug","-Wunused-result")

target("fast_test")
    set_kind("binary")
    add_includedirs("src",
                    "src/io",
                    "src/net",
                    "src/mqtt",
                    "src/plug_dynamic",
                    "src/utils",
                    "3rdpart/doctest-master",
                    "3rdpart/asio"
                    --[[,"/usr/lib/gcc/x86_64-linux-gnu/11/include"]])
    add_files(
              "src/*.cpp",
              "src/utils/*.cppm",
              "run/doctest_run.cpp",
              "test/simple2.cpp"
              )

    set_languages("c++20")
    --[[ set_policy("build.c++.modules", true) ]]
    add_links("gtest", "gmock", "async_simple", "std", "aio", "pthread",
"boost_log" ,"boost_system", "boost_thread" ,"boost_filesystem", "boost_atomic","boost_date_time" ,"boost_chrono", "boost_regex",
"boost_coroutine", "boost_context", "boost_program_options",
"boost_unit_test_framework")

--[[ add_requires("gtest")

target("std")
    set_kind("static")
    add_files("third_party_module/stdmodules/*.cppm")
    add_includedirs("third_party_module/stdmodules")
    set_languages("c++20")

target("asio")
    set_kind("static")
    add_files("third_party_module/asio/asio.cppm")
    add_includedirs("third_party_module/asio")
    set_languages("c++20")

target("async_simple")
    set_kind("static")
    add_files("async_simple_module/*.cppm",
              "async_simple_module/coro/*.cppm",
              "async_simple_module/executors/*.cppm",
              "async_simple_module/uthread/*.cppm",
              "async_simple_module/uthread/internal/*.cppm",
              "async_simple_module/uthread/internal/*.S",
              "async_simple_module/util/*.cppm")
    add_deps("std")
    set_languages("c++20")

target("async_simple_test")
    add_files("async_simple_module/test/*.cpp")
    add_deps("async_simple", "std")
    add_links("gtest", "gmock", "async_simple", "std", "aio", "pthread")

target("async_simple_coro_test")
    add_files("async_simple_module/test/coro/*.cpp", "async_simple_module/test/dotest.cpp")
    add_deps("async_simple", "std")
    add_links("gtest", "gmock", "async_simple", "std", "aio", "pthread")

target("async_simple_uthread_test")
    add_files("async_simple_module/test/uthread/*.cpp", "async_simple_module/test/dotest.cpp")
    add_deps("async_simple", "std")
    add_links("gtest", "gmock", "async_simple", "std", "aio", "pthread")

target("async_simple_util_test")
    add_files("async_simple_module/test/util/*.cpp", "async_simple_module/test/dotest.cpp")
    add_deps("async_simple", "std")
    add_links("gtest", "gmock", "async_simple", "std", "aio", "pthread") ]]

